package com.mao.spring.cloud.controller;

import com.mao.spring.cloud.api.EmployeeRemoteService;
import com.mao.spring.cloud.entity.Employee;
import com.mao.spring.cloud.util.ResultEntity;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

/**
 * @author: Administrator
 * @description:
 * @cteate 2021-06-15-20:41
 */
@RestController
public class FeignHumanResourceController {

    @Resource
    private EmployeeRemoteService employeeRemoteService;

    @RequestMapping("/feign/consumer/get/emp")
    public Employee getEmployeeRemote(){
        return employeeRemoteService.getEmployeeRemote();
    }

    @RequestMapping("/feign/consumer/search/emp")
    public List<Employee> getEmpList(String keyword){
        return employeeRemoteService.getEmpListRemote(keyword);
    }

    @RequestMapping("/feign/consumer/get/emp/with/breaker")
    public ResultEntity<Employee> getEmp(@RequestParam("signal") String signal){return employeeRemoteService.getEmp(signal);}
}
